return {
  {
    "mason-org/mason-lspconfig.nvim",
    event = "VeryLazy",
    opts = {},
    dependencies = {
      { "mason-org/mason.nvim", opts = {} },
      { "neovim/nvim-lspconfig" }
    },
    config = function()
      -- 初始化Mason
      require("mason").setup()
      require("mason-lspconfig").setup({
        ensure_installed = { "lua_ls", "pyright", "clangd" }, -- 按需添加需要的LSP服务器
        automatic_installation = true,                        -- 自动安装缺失的LSP
      })


      -- 配置LSP服务器
      -- local lspconfig = require("lspconfig")  nvim 0.11更新后废弃
      local on_attach = function(client, bufnr)
        -- 其他按键映射...
        local opts = { noremap = true, silent = true, buffer = bufnr }

        -- 格式化按键映射
        vim.keymap.set('n', '<leader>f', function()
          vim.lsp.buf.format({ async = true })
        end, opts)

        -- 如果客户端支持文档格式化，设置自动格式化
        if client.supports_method("textDocument/formatting") then
          -- 保存时自动格式化（可选，根据个人喜好）
          vim.api.nvim_create_autocmd("BufWritePre", {
            buffer = bufnr,
            callback = function()
              vim.lsp.buf.format({ async = false })
            end,
          })
        end
      end

      -- 通用LSP设置
      local capabilities = require("cmp_nvim_lsp").default_capabilities()

      -- 配置特定语言服务器
      -- Lua
      vim.lsp.config('lua_ls', {
        on_attach = on_attach,
        settings = {
          Lua = {
            diagnostics = { globals = { "vim" } },
          },
        },
      })
      vim.lsp.enable('lua_ls') -- 启用 lua_ls 服务器

      -- Python
      vim.lsp.config('pyright', {
        on_attach = on_attach,
      })
      vim.lsp.enable('pyright')

      --C
      vim.lsp.config('clangd', {
        on_attach = on_attach,
        capabilities = capabilities,
      })
      vim.lsp.enable('clangd')

      -- 可以继续添加更多语言服务器...
    end,
  },




  --自动补全引擎
  {
    "hrsh7th/nvim-cmp",
    -- event = "InsertEnter",
    event = "VeryLazy",
    dependencies = {
      "hrsh7th/cmp-nvim-lsp", -- LSP作为补全源
      "hrsh7th/cmp-buffer",   -- 缓冲区补全
      "hrsh7th/cmp-path",     -- 路径补全
    },
    config = function()
      -- 配置nvim-cmp
      local cmp = require("cmp")
      cmp.setup({
        sources = {
          { name = "nvim_lsp" },
          { name = "buffer" },
          { name = "path" },
        },
        mapping = cmp.mapping.preset.insert({
          ["<C-Space>"] = cmp.mapping.complete(),
          ["<CR>"] = cmp.mapping.confirm({ select = true }),
        }),
      })
    end,
  }
}
